#! /usr/bin/python
# -*- coding: utf-8 -*-
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
# GlobalVariables class
#_________________________________________________________
# A.Z. - 03/08 => Creation
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
from qviewF import *


class GlobalVariables:
  """
  Global Variables used throughout all the program files.
  """

  def __init__(self):
    self.id          = -1     # ID of current marked star in the figure

    # These arrays hold the original data points
    self.tjd         = []     # Time (Julian Date)
    self.t           = []     # Time (seconds from first point)
    self.nt          = -1     # Numer of time points
    self.y           = []     # Counts (list of list ... many plots)
    self.ny          = -1     # Number of plots (and lists in y)

    # This array holds the changed data points
    self.Cy          = []     # Changed counts (list of list ... many plots)

    # Fourier transform data
    self.nf          = None   # Number of frequencies
    self.fmin        = None   # Minimum frequency  (1 over self.t units)
    self.fmax        = None   # Maximum frequency  (1 over self.t units)
    self.f           = []     # Frequencies        (1 over self.t units)
    self.dft         = []     # Discrete Fourier Transform of Cy without deleted
                              # points (list of list ... many plots)

    self.delete      = []     # Id of deleted stars
    self.axes        = 0      # Axes over which the mouse is
    self.figure      = 0      # Figure over which the mouse is

    # Input files and columns numbers
    self.fileName    = None   # Name of the file with the original data
    self.editable    = None   # File with user python commands
    self.tCol        = None   # Column with time points
    self.yCol        = None   # Columns with counts points

    # DisplayImage instance
    self.display     = None

    # Logical Variables
    self.shiftHold   = False  # Shift key is pressed?
    self.controlHold = False  # Control key is pressed?
    self.firstPlot   = True   # Is it the first time the plot is made?

    # Output files
    self.ofile       = None   # Output data file name
    self.odftfile    = None   # Output data file name for the dft

    # X roll and magnify
    self.tr          = 0.0    # X Roll for time
    self.tm          = 1.0    # X Magnify for time
    self.fr          = 0.0    # X Roll for frequency
    self.fm          = 1.0    # X Magnify for frequency

    # Figure with original(unedited) data
    self.FO          = None   # Figure instance
    self.SO          = []     # Axes instances for each subplot
    self.CO          = []     # Cursos instances for each subplot

    # Figure with edited data
    self.FE          = None   # Figure instance
    self.SE          = []     # Axes instances for each subplot
    self.CE          = []     # Cursos instances for each subplot

    # Figure with discrete fourier transform
    self.FD          = None   # Figure instance
    self.SD          = []     # Axes instances for each subplot
    self.CD          = []     # Cursos instances for each subplot



gv = GlobalVariables()
